/* 移入事件 */
var catalog = document.getElementById("catalog");

var allMoves = document.getElementsByClassName("move");

for (var i = 0; i < allMoves.length; i++) {
    allMoves[i].onmouseover = function () {
        this.lastElementChild.style.display = "block";
        var moveIndex = getIndex(this)
        changePStyleByIndex(moveIndex);
        allMoves[moveIndex].firstElementChild.className = "after active";
        allMoves[0].firstElementChild.className = "after active";
    }
    allMoves[i].onmouseout = function () {
        this.lastElementChild.style.display = "none";
        var moveIndex = getIndex(this);
        allMoves[moveIndex].firstElementChild.className = "after";
        allMoves[0].firstElementChild.className = "after active"
    }

}


function getIndex(t){
    for(var i = 0;i<allMoves.length;i++){
        var index = -1;
        if(allMoves[i]==t){
            index = i;
            break;
        }
    }return index;
}



function changePStyleByIndex(n){
    for(var i = 0;i < allMoves.length;i++){
        if(i == n){
            allMoves[i].firstElementChild.className = "after active";
        }else{
            allMoves[i].firstElementChild.className = "after";
        }
        allMoves[0].firstElementChild.className = "after active"
    }
}


var address = document.getElementById("address")
var address1 = address.getElementsByClassName("address")
address.onmousemove = function(){
    address.lastElementChild.style.display = "block";
    address1[0].firstElementChild.style.borderTop = "8px solid #059FFF"
}
address.onmouseout = function(){
    address.lastElementChild.style.display = "none";
    address1[0].firstElementChild.style.borderTop = "8px solid white"
}



var check = document.getElementById("check");
var choice = document.getElementById("choice");
choice.onclick = function(){
        if(check.value == 1){
            choice.style.backgroundPosition = "-2px -4px"
            check.value=0;
        }else{
            choice.style.backgroundPosition = "-2px -48px"
            check.value=1;
        }
}
check.onclick = function(){
    if(check.value == 1){
        choice.style.backgroundPosition = "-2px -4px"
        check.value=0;
    }else{
        choice.style.backgroundPosition = "-2px -48px"
        check.value=1;
    }
}